<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="../js/jquery-3.2.1.min.js" type="text/javascript" charset="utf-8"></script>
		
		<script type="text/javascript">
			/*window.onload只能定义一次，而$(function())可以定义多次*/
			/*dom文档加载完成后执行*/
			$(function(){
				$("#btn2").click(function(){
					alert("aa");
				});
			});
			$(function(){
				alert("123")
			})
			$(function(){
				//div背景色修改
				$("#div1").css("backgroundColor","red");
				$("#div1").css("width","500px");
				$("#div1").css("height","40px");
				$("#div1").css("margin","auto");
			})
		</script>
	</head>
	<body>
		
		<div id="div1">
			div1....
		</div>
		<div id="div2">
			div2....
		</div>
		
		<input type="button" name="btn" id="btn" value="点我" />
		<input type="button" name="btn2" id="btn2" value="再点我" />
		
		<script type="text/javascript">
			/*事件*/
			$("#btn").click(function(){
				alert($("div").html());
			});
		</script>
		 
	</body>
</html>
